<?php

namespace App\Exceptions;

use Mjy191\Tools\Tools;
use Exception;

class ApiException extends Exception
{
    /**
     * 转换异常为 HTTP 响应
     *
     * @param \Illuminate\Http\Request
     * @return \Illuminate\Http\Response
     */
    public function render($request)
    {
        return response()->json(Tools::returnData(null,$this->getCode(),$this->getMessage()))->setEncodingOptions(JSON_UNESCAPED_UNICODE);
    }
}
